var fs = require('fs'),
    path = require('path'),
    ds = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../') + './conf.json')),
    mongoose = require('mongoose'),
	uri = ds.dburl;
/**
  * 连接成功
  */
mongoose.connection.on('connected', function () {    
    console.log('Mongoose connection open to ' + uri);  
});    

/**
 * 连接异常
 */
mongoose.connection.on('error',function (err) {    
    console.log('Mongoose connection error: ' + err);  
});    
 
/**
 * 连接断开
 */
mongoose.connection.on('disconnected', function () {    
    console.log('Mongoose connection disconnected');  
});  

mongoose.connect(uri);